import request from '@/utils/request'

// 获取部门列表
export function getDepartment() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

// 删除部门
export function deleteDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

// 新增部门
export function addDepartment(data) {
  return request({
    url: `/company/department`,
    method: 'post',
    data
  })
}

// 根据id来获取对应的部门详情，用来在编辑部门时回显数据用
export function getDepartmentDetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}

// 根据 id 修改部门详情
export function editDepartment(data) {
  return request({
    url: '/company/department/' + data.id,
    method: 'put',
    data
  })
}
